home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Delphi Magazine Collection 2001
/
Delphi Magazine Collection 20001 (2001).iso
/
DISKS
/
ISSUE18
/
SURVIVE
/
SETUP.SQL
< prev
Wrap
Text File
|
1996-11-19
|
2KB
|
45 lines
CREATE TABLE Users(
UserID int, /* System ID Number */
Username char(30), /* Login user name */
FirstName char(20), /* User's proper first name */
LastName char(20), /* User's proper last name */
DateLastLogin datetime, /* Date and time of last login */
DateLastPasswordChange datetime, /* Date and time of last password change */
PasswordLifespan smallint) /* Number of days between forced password change */
GO
GRANT ALL ON Users TO Public
GO
CREATE TABLE AuditTrail(
AuditTrailID int identity, /* Auto-increment key field */
ApplicationID smallint, /* Identifies the app originating the event */
EventID smallint, /* Identifies the event (login, logout, change password, etc.) */
Timestamp datetime, /* Date and time of the event */
UserID integer null, /* Identifies the user originating the event */
Description varchar(255)) /* Message associated with event */
GO
GRANT ALL ON AuditTrail TO Public
GO
create procedure ChangePassword(
@Username varchar(30),
@OldPassword varchar(30),
@NewPassword varchar(30))
as
begin
declare @Result integer
execute @Result = sp_password @OldPassword, @NewPassword
if @Result <> 0
begin
raiserror 50001 "Could not change user password"
return
end
update Users
set DateLastPasswordChange = getdate()
where Username = @username
end
go
grant execute on ChangePassword to Public
go